home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / Finder.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  14.1 KB  |  390 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Finder.p
  3.  
  4.      Contains:    Finder flags and container types.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Finder;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __FINDER__}
  27. {$SETC __FINDER__ := 1}
  28.  
  29. {$I+}
  30. {$SETC FinderIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __QUICKDRAW__}
  37. {$I Quickdraw.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __EVENTS__}
  40. {$I Events.p}
  41. {$ENDC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. { Creator and type of clipping files }
  49.  
  50. CONST
  51.     kClippingCreator            = 'drag';
  52.     kClippingPictureType        = 'clpp';
  53.     kClippingTextType            = 'clpt';
  54.     kClippingSoundType            = 'clps';
  55.     kClippingUnknownType        = 'clpu';
  56.  
  57.  
  58. { Creator and type of Internet Location files }
  59.     kInternetLocationCreator    = 'drag';
  60.     kInternetLocationHTTP        = 'ilht';
  61.     kInternetLocationFTP        = 'ilft';
  62.     kInternetLocationFile        = 'ilfi';
  63.     kInternetLocationMail        = 'ilma';
  64.     kInternetLocationNNTP        = 'ilnw';
  65.     kInternetLocationAFP        = 'ilaf';
  66.     kInternetLocationAppleTalk    = 'ilat';
  67.     kInternetLocationGeneric    = 'ilge';
  68.  
  69.  
  70.  
  71.     kCustomIconResource            = -16455;                        {  Custom icon family resource ID  }
  72.  
  73. { In order to specify any of the information described in the }
  74. { CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid }
  75. { and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, }
  76. { and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to }
  77. { the file or to the "Icon/n" file for a folder }
  78.     kCustomBadgeResourceType    = 'badg';
  79.     kCustomBadgeResourceID        = -16455;
  80.     kCustomBadgeResourceVersion    = 0;
  81.  
  82.  
  83. TYPE
  84.     CustomBadgeResourcePtr = ^CustomBadgeResource;
  85.     CustomBadgeResource = RECORD
  86.         version:                SInt16;                                    {  This is version kCustomBadgeResourceVersion }
  87.         customBadgeResourceID:    SInt16;                                    {  If not 0, the ID of a resource to use on top }
  88.                                                                         {  of the icon for this file or folder }
  89.         customBadgeType:        OSType;                                    {  If not 0, the type and creator of an icon }
  90.         customBadgeCreator:        OSType;                                    {  to use on top of the icon }
  91.         windowBadgeType:        OSType;                                    {  If not 0, the type and creator of an icon }
  92.         windowBadgeCreator:        OSType;                                    {  to display in the header of the window for this  }
  93.                                                                         {  file or folder }
  94.         overrideType:            OSType;                                    {  If not 0, the type and creator of an icon to }
  95.         overrideCreator:        OSType;                                    {  use INSTEAD of the icon for this file or folder }
  96.     END;
  97.  
  98.     CustomBadgeResourceHandle            = ^CustomBadgeResourcePtr;
  99. { You can specify routing information for a file by including a 'rout' 0 
  100.     resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended 
  101.     Finder flags. 
  102.     The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
  103.     in turn. The first matching entry is used.
  104.     If the creator and fileType match the file being dropped and targetFolder match
  105.     the folder ID of the folder being dropped onto, then the file is rerouted 
  106.     into the specified destination folder.
  107.     The only target folder currently supported is the system folder, 
  108.     kSystemFolderType = 'macs'.
  109. }
  110.  
  111. CONST
  112.     kRoutingResourceType        = 'rout';
  113.     kRoutingResourceID            = 0;
  114.  
  115.  
  116. TYPE
  117.     RoutingResourceEntryPtr = ^RoutingResourceEntry;
  118.     RoutingResourceEntry = RECORD
  119.         creator:                OSType;                                    {  Use '****' or 0 to match any creator  }
  120.         fileType:                OSType;                                    {  Use '****' or 0 to match any file type  }
  121.         targetFolder:            OSType;                                    {  Folder ID of the folder this file was dropped onto  }
  122.         destinationFolder:        OSType;                                    {  Folder that the source will be routed to  }
  123.         reserved:                OSType;                                    {  Set to 0  }
  124.     END;
  125.  
  126.     RoutingResourcePtr                    = ^RoutingResourceEntry;
  127.     RoutingResourceHandle                = ^RoutingResourcePtr;
  128.  
  129. { Types for special container aliases }
  130.  
  131. CONST
  132.     kContainerFolderAliasType    = 'fdrp';                        {  type for folder aliases  }
  133.     kContainerTrashAliasType    = 'trsh';                        {  type for trash folder aliases  }
  134.     kContainerHardDiskAliasType    = 'hdsk';                        {  type for hard disk aliases  }
  135.     kContainerFloppyAliasType    = 'flpy';                        {  type for floppy aliases  }
  136.     kContainerServerAliasType    = 'srvr';                        {  type for server aliases  }
  137.     kApplicationAliasType        = 'adrp';                        {  type for application aliases  }
  138.     kContainerAliasType            = 'drop';                        {  type for all other containers  }
  139.     kDesktopPrinterAliasType    = 'dtpa';                        {  type for Desktop Printer alias  }
  140.     kContainerCDROMAliasType    = 'cddr';                        {  type for CD-ROM alias  }
  141.  
  142. { Types for Special folder aliases }
  143.     kSystemFolderAliasType        = 'fasy';
  144.     kAppleMenuFolderAliasType    = 'faam';
  145.     kStartupFolderAliasType        = 'fast';
  146.     kPrintMonitorDocsFolderAliasType = 'fapn';
  147.     kPreferencesFolderAliasType    = 'fapf';
  148.     kControlPanelFolderAliasType = 'fact';
  149.     kExtensionFolderAliasType    = 'faex';
  150.  
  151. { Types for AppleShare folder aliases }
  152.     kExportedFolderAliasType    = 'faet';
  153.     kDropFolderAliasType        = 'fadr';
  154.     kSharedFolderAliasType        = 'fash';
  155.     kMountedFolderAliasType        = 'famn';
  156.  
  157. { Finder flags (finderFlags, fdFlags and frFlags) }
  158. { Any flag reserved or not specified should be set to 0. }
  159. { If a flag applies to a file, but not to a folder, make sure to check }
  160. { that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) }
  161.     kIsOnDesk                    = $0001;                        {  Files and folders  }
  162.     kColor                        = $000E;                        {  Files and folders  }
  163.                                                                 {  bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use }
  164.     kIsShared                    = $0040;                        {  Files only (Applications only)  }
  165.                                                                 {  If clear, the application needs to write to  }
  166.                                                                 {  its resource fork, and therefore cannot be  }
  167.                                                                 {  shared on a server  }
  168.     kHasNoINITs                    = $0080;                        {  Files only (Extensions/Control Panels only)  }
  169.                                                                 {  This file contains no INIT resource  }
  170.     kHasBeenInited                = $0100;                        {  Files only  }
  171.                                                                 {  Clear if the file contains desktop database  }
  172.                                                                 {  resources ('BNDL', 'FREF', 'open', 'kind'...)  }
  173.                                                                 {  that have not been added yet. Set only by the Finder  }
  174.                                                                 {  bit 0x0200 was the letter bit for AOCE, but is now reserved for future use  }
  175.     kHasCustomIcon                = $0400;                        {  Files and folders  }
  176.     kIsStationery                = $0800;                        {  Files only  }
  177.     kNameLocked                    = $1000;                        {  Files and folders  }
  178.     kHasBundle                    = $2000;                        {  Files only  }
  179.     kIsInvisible                = $4000;                        {  Files and folders  }
  180.     kIsAlias                    = $8000;                        {  Files only  }
  181.  
  182. { Obsolete. Use names defined above. }
  183.     fOnDesk                        = $0001;
  184.     fHasBundle                    = $2000;
  185.     fInvisible                    = $4000;
  186.  
  187. { Obsolete }
  188.     fTrash                        = -3;
  189.     fDesktop                    = -2;
  190.     fDisk                        = 0;
  191.  
  192. {$IFC OLDROUTINENAMES }
  193.     kIsStationary                = $0800;
  194.  
  195. {$ENDC}  {OLDROUTINENAMES}
  196.  
  197. { Extended flags (extendedFinderFlags, fdXFlags and frXFlags) }
  198. { Any flag not specified should be set to 0. }
  199.     kExtendedFlagsAreInvalid    = $8000;                        {  If set the other extended flags are ignored  }
  200.     kExtendedFlagHasCustomBadge    = $0100;                        {  Set if the file or folder has a badge resource  }
  201.     kExtendedFlagHasRoutingInfo    = $0004;                        {  Set if the file contains routing info resource  }
  202.  
  203.  
  204.  
  205. { Use this creation date to indicate that a file is temporarily busy }
  206. { (while it is being downloaded or installed for example) }
  207. { This will prevent the Finder from attempting to change attributes }
  208. { of the file until it is fully created. }
  209.     kMagicBusyCreationDate        = $4F3AFDB0;
  210.  
  211.  
  212. {------------------------------------------------------------------------}
  213. {
  214.    The following data structures are binary compatible with FInfo, DInfo,
  215.    FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
  216.    Use these data structures preferably to FInfo, etc...
  217. }
  218. {------------------------------------------------------------------------}
  219.  
  220.  
  221. TYPE
  222.     FileInfoPtr = ^FileInfo;
  223.     FileInfo = RECORD
  224.         fileType:                OSType;                                    {  The type of the file  }
  225.         fileCreator:            OSType;                                    {  The file's creator  }
  226.         finderFlags:            UInt16;                                    {  ex: kHasBundle, kIsInvisible...  }
  227.         location:                Point;                                    {  File's location in the folder  }
  228.                                                                         {  If set to (0, 0), the Finder will place the item automatically  }
  229.         reserved:                UInt16;                                    {  (set to 0)  }
  230.     END;
  231.  
  232.     FolderInfoPtr = ^FolderInfo;
  233.     FolderInfo = RECORD
  234.         windowBounds:            Rect;                                    {  The position and dimension of the folder's window  }
  235.         finderFlags:            UInt16;                                    {  ex. kIsInvisible, kNameLocked, etc. }
  236.         location:                Point;                                    {  Folder's location in the parent folder  }
  237.                                                                         {  If set to (0, 0), the Finder will place the item automatically  }
  238.         reserved:                UInt16;                                    {  (set to 0)  }
  239.     END;
  240.  
  241.     ExtendedFileInfoPtr = ^ExtendedFileInfo;
  242.     ExtendedFileInfo = RECORD
  243.         reserved:                ARRAY [0..3] OF SInt16;                    {  Reserved (set to 0)  }
  244.         extendedFinderFlags:    UInt16;                                    {  Extended flags (custom badge, routing info...)  }
  245.         reserved2:                SInt16;                                    {  Reserved (set to 0). Comment ID if high-bit is clear  }
  246.         putAwayFolderID:        SInt32;                                    {  Put away folder ID  }
  247.     END;
  248.  
  249.     ExtendedFolderInfoPtr = ^ExtendedFolderInfo;
  250.     ExtendedFolderInfo = RECORD
  251.         scrollPosition:            Point;                                    {  Scroll position (for icon views)  }
  252.         reserved:                SInt32;                                    {  Reserved (set to 0)  }
  253.         extendedFinderFlags:    UInt16;                                    {  Extended flags (custom badge, routing info...)  }
  254.         reserved2:                SInt16;                                    {  Reserved (set to 0). Comment ID if high-bit is clear  }
  255.         putAwayFolderID:        SInt32;                                    {  Put away folder ID  }
  256.     END;
  257.  
  258. {------------------------------------------------------------------------}
  259. {
  260.    The following data structures are here for compatibility.
  261.    Use the new data structures replacing them if possible (i.e. FileInfo 
  262.    instead of FInfo, etc...)
  263. }
  264. {------------------------------------------------------------------------}
  265. { File info }
  266. {
  267.      IMPORTANT:
  268.      In MacOS 8, the fdFldr field has become reserved for the Finder.
  269. }
  270.     FInfoPtr = ^FInfo;
  271.     FInfo = RECORD
  272.         fdType:                    OSType;                                    {  The type of the file  }
  273.         fdCreator:                OSType;                                    {  The file's creator  }
  274.         fdFlags:                UInt16;                                    {  Flags ex. kHasBundle, kIsInvisible, etc.  }
  275.         fdLocation:                Point;                                    {  File's location in folder.  }
  276.                                                                         {  If set to (0, 0), the Finder will place the item automatically  }
  277.         fdFldr:                    SInt16;                                    {  Reserved (set to 0)  }
  278.     END;
  279.  
  280. { Extended file info }
  281. {
  282.      IMPORTANT:
  283.      In MacOS 8, the fdIconID and fdComment fields were changed
  284.      to become reserved fields for the Finder.
  285.        The fdScript has become an extended flag.
  286. }
  287.     FXInfoPtr = ^FXInfo;
  288.     FXInfo = RECORD
  289.         fdIconID:                SInt16;                                    {  Reserved (set to 0)  }
  290.         fdReserved:                ARRAY [0..2] OF SInt16;                    {  Reserved (set to 0)  }
  291.         fdScript:                SInt8;                                    {  Extended flags. Script code if high-bit is set  }
  292.         fdXFlags:                SInt8;                                    {  Extended flags  }
  293.         fdComment:                SInt16;                                    {  Reserved (set to 0). Comment ID if high-bit is clear  }
  294.         fdPutAway:                SInt32;                                    {  Put away folder ID  }
  295.     END;
  296.  
  297. { Folder info }
  298. {
  299.      IMPORTANT:
  300.      In MacOS 8, the frView field was changed to become reserved 
  301.        field for the Finder.
  302. }
  303.     DInfoPtr = ^DInfo;
  304.     DInfo = RECORD
  305.         frRect:                    Rect;                                    {  Folder's window bounds  }
  306.         frFlags:                UInt16;                                    {  Flags ex. kIsInvisible, kNameLocked, etc. }
  307.         frLocation:                Point;                                    {  Folder's location in parent folder  }
  308.                                                                         {  If set to (0, 0), the Finder will place the item automatically  }
  309.         frView:                    SInt16;                                    {  Reserved (set to 0)  }
  310.     END;
  311.  
  312. { Extended folder info }
  313. {
  314.      IMPORTANT:
  315.      In MacOS 8, the frOpenChain and frComment fields were changed
  316.      to become reserved fields for the Finder.
  317.        The frScript has become an extended flag.
  318. }
  319.     DXInfoPtr = ^DXInfo;
  320.     DXInfo = RECORD
  321.         frScroll:                Point;                                    {  Scroll position  }
  322.         frOpenChain:            SInt32;                                    {  Reserved (set to 0)  }
  323.         frScript:                SInt8;                                    {  Extended flags. Script code if high-bit is set  }
  324.         frXFlags:                SInt8;                                    {  Extended flags  }
  325.         frComment:                SInt16;                                    {  Reserved (set to 0). Comment ID if high-bit is clear  }
  326.         frPutAway:                SInt32;                                    {  Put away folder ID  }
  327.     END;
  328.  
  329. { Values of the 'message' parameter to a Control Panel 'cdev' }
  330.  
  331. CONST
  332.     initDev                        = 0;                            { Time for cdev to initialize itself }
  333.     hitDev                        = 1;                            { Hit on one of my items }
  334.     closeDev                    = 2;                            { Close yourself }
  335.     nulDev                        = 3;                            { Null event }
  336.     updateDev                    = 4;                            { Update event }
  337.     activDev                    = 5;                            { Activate event }
  338.     deactivDev                    = 6;                            { Deactivate event }
  339.     keyEvtDev                    = 7;                            { Key down/auto key }
  340.     macDev                        = 8;                            { Decide whether or not to show up }
  341.     undoDev                        = 9;
  342.     cutDev                        = 10;
  343.     copyDev                        = 11;
  344.     pasteDev                    = 12;
  345.     clearDev                    = 13;
  346.     cursorDev                    = 14;
  347.  
  348.  
  349. { Special values a Control Panel 'cdev' can return }
  350.     cdevGenErr                    = -1;                            { General error; gray cdev w/o alert }
  351.     cdevMemErr                    = 0;                            { Memory shortfall; alert user please }
  352.     cdevResErr                    = 1;                            { Couldn't get a needed resource; alert }
  353.     cdevUnset                    = 3;                            {  cdevValue is initialized to this }
  354.  
  355. { Control Panel Default Proc }
  356.  
  357. TYPE
  358. {$IFC TYPED_FUNCTION_POINTERS}
  359.     ControlPanelDefProcPtr = FUNCTION(message: INTEGER; item: INTEGER; numItems: INTEGER; cPanelID: INTEGER; VAR theEvent: EventRecord; cdevValue: LONGINT; cpDialog: DialogPtr): LONGINT;
  360. {$ELSEC}
  361.     ControlPanelDefProcPtr = ProcPtr;
  362. {$ENDC}
  363.  
  364.     ControlPanelDefUPP = UniversalProcPtr;
  365.  
  366. CONST
  367.     uppControlPanelDefProcInfo = $000FEAB0;
  368.  
  369. FUNCTION NewControlPanelDefProc(userRoutine: ControlPanelDefProcPtr): ControlPanelDefUPP;
  370.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  371.     INLINE $2E9F;
  372.     {$ENDC}
  373.  
  374. FUNCTION CallControlPanelDefProc(message: INTEGER; item: INTEGER; numItems: INTEGER; cPanelID: INTEGER; VAR theEvent: EventRecord; cdevValue: LONGINT; cpDialog: DialogPtr; userRoutine: ControlPanelDefUPP): LONGINT;
  375.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  376.     INLINE $205F, $4E90;
  377.     {$ENDC}
  378.  
  379.  
  380. {$ALIGN RESET}
  381. {$POP}
  382.  
  383. {$SETC UsingIncludes := FinderIncludes}
  384.  
  385. {$ENDC} {__FINDER__}
  386.  
  387. {$IFC NOT UsingIncludes}
  388.  END.
  389. {$ENDC}
  390.